package spring.yongongsystem.mapper;

import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import spring.yongongsystem.POJO.dto.GroupPageQueryDTO;
import spring.yongongsystem.POJO.entity.Group;

@Mapper
public interface GroupMapper{

    @Insert("insert into `group`(group_name)" +
            " VALUES" +
            " (#{groupName})")
    void insert(Group group);
    Page<Group> pageQuery(GroupPageQueryDTO groupPageQueryDTO);

    @Delete("delete from `group` where id = #{id}")
    void deleteById(Long id);

    void update(Group group);

    @Select("SELECT COUNT(*) FROM `group`;")
    long count();
}